import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int time=sc.nextInt();
        double sum=0.0;
        double max=sc.nextDouble();
        sum+=max;
        double min=sc.nextDouble();
        sum+=min;
        double tem=0.0;
        if (max<min){
            tem=max;
            max=min;
            min=tem;
        }
        if (time>100000){
            for (int i=2;i<time;i++){
                tem+=sc.nextDouble();
                sum+=tem;
            }
        }
        for (int i=2;i<time;i++){
            tem=sc.nextDouble();
            sum+=tem;
            if (tem>max){
                max=tem;
            }else if (tem<min){
                min=tem;
            }
        }
        sum=(sum-max-min)/(time-2);
        System.out.printf("%.2f",sum);
    }
}
